const fs = require("fs")

var TurndownService = require('turndown')
var turndownService = new TurndownService()

function html2md(html, outPath) {
    turndownService.remove('a')

    var markdown = turndownService.turndown(html)
    fs.writeFileSync(outPath, markdown)
    console.log(outPath, "done!");
}


/* 测试用例 */
// (function () {
//     const html = fs.readFileSync("./test.html").toString()
//     html2md(html, "./test.md")
// })()

module.exports = {
    html2md
}